using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace DB
{
    /// <summary>
    /// Summary description for clsUserSecurityList
    /// </summary>
    public class clsUserSecurityList
    {
        int m_iUserID;
        protected DataSet m_dtsData;
        protected DataView m_dtvDataView;
        protected String m_strSortExpression;
        protected String m_strFilterExpression;

        public clsUserSecurityList(int UserID)
        {
            m_iUserID = UserID;
            Initialise();
        }

        // 2007/09/04
        // Properties
        #region Properties
        public String FilterExpression
        {
            get
            {
                return m_strFilterExpression;
            }
            set
            {
                m_strFilterExpression = value;                
            }
        }

        public String SortExpression
        {
            get
            {
                return m_strSortExpression;
            }
            set
            {
                m_strSortExpression = value;
            }
        }
        #endregion
        public DataView GetRecords()
        {
            // 2007/09/04
            // Returns a view of the records from the database, filtered by both security
            //  filters and user-defined search filters.
            m_dtvDataView.RowFilter = this.FilterExpression;
            m_dtvDataView.Sort = this.SortExpression;
            return m_dtvDataView;
        }

        protected void Initialise()
        {
            m_dtsData = DataConnection.GetDataObject().GetData("Data", "spUserSecurityRights " + m_iUserID);
            m_dtvDataView = m_dtsData.DefaultViewManager.CreateDataView(m_dtsData.Tables[0]);
        }
    }


}
